package code.创建型模式.FactoryMethod.demo1;

/**
 * @author guanyuan.wu.sz
 */
public class FactoryMethodMain {


  public static void main(String[] args) {
    IFactory factory = new UndergraduateFactory();
    Graduate student = (Graduate) factory.createLeiFeng();
    student.buyRice();
    student.wash();
    
    IFactory vFactory = new VolunteerFactory();
    Volunteer volunteer = (Volunteer) vFactory.createLeiFeng();
    volunteer.buyRice();
    volunteer.sweep();
    
  }

}
